package com.ycb.bookserver.controller.user;

import com.book.result.Result;
import com.ycb.book.entity.Category;
import com.ycb.bookserver.service.CategoryService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/user/category")
public class UserCategoryController {
    @Autowired
    CategoryService categoryService;

    @GetMapping("/list")
    @ApiOperation("用户端获取所有分类")
    public Result getCategory(){
        List<Category> categoryList=categoryService.getCategory();
        return Result.success(categoryList);
    }
}
